package chapter_3.message.entity;

import java.util.Objects;

public class ResponseMessage extends AbstractMessage {
    private Candidate candidate;
    private Boolean isInquiry;
    public ResponseMessage(Boolean InquiryFlag, Candidate candidate){
        super(true,InquiryFlag);
        this.candidate = candidate;
    }

    public Candidate getCandidate() {
        return candidate;
    }

    public void setCandidate(Candidate candidate) {
        this.candidate = candidate;
    }

    @Override
    public boolean equals(Object obj) {
        if(obj == null){
            return false;
        }
        if(obj == this){
            return true;
        }
        if(getClass() == obj.getClass()){
            ResponseMessage other = (ResponseMessage) obj;
            return super.equals(obj) && candidate.equals(other.getCandidate());
        }
       return false;
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(),candidate.hashCode());
    }
}
